#ifndef WF_DRAWTEXT_H
#define WF_DRAWTEXT_H

#include "pf_previewactioninterface.h"
#include "pf_text.h"
#include "gui_export.h"

/**
 * This action class can handle user events to draw texts.
 *
 */
class GUI_EXPORT WF_DrawText : public PF_PreviewActionInterface {
	Q_OBJECT
public:
    /**
     * Action States.
     */
    enum Status {
        ShowDialog,           /**< Showing the text dialog. */
        SetPos,               /**< Setting the position. */
		SetText               /**< Settting the text in the command line. */
    };

public:
    WF_DrawText(PF_Container& container,
                      PF_GraphicView& graphicView);
    ~WF_DrawText() {}

	static QAction* createGUIAction(LX_Define::ActionType /*type*/, QObject* /*parent*/);
	
	virtual LX_Define::ActionType rtti() {
		return LX_Define::ActionDrawText;
	}

    virtual void init(int status=0);

	void reset();
	
    virtual void trigger();
	void preparePreview();
	
    virtual void mouseMoveEvent(PF_MouseEvent* e);
    virtual void mouseReleaseEvent(PF_MouseEvent* e);
	
	virtual void coordinateEvent(PF_CoordinateEvent* e);
    virtual void commandEvent(PF_CommandEvent* e);
	virtual PF_StringList getAvailableCommands();

    virtual void hideOptions();
    virtual void showOptions();

    virtual void updateMouseButtonHints();
    virtual void updateMouseCursor();
    virtual void updateToolBar();

	void setText(const PF_String& t);
	PF_String getText();

	void setAngle(double a);
	double getAngle();

private:
    PF_TextAttribute data;
	//PF_Text* text;
    PF_Vector pos;
	bool textChanged;
};

#endif
